﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL_HealthInsurance;
using System.Data;
using DTO_HealthInsurance;
using BLL_HealthInsurance;
namespace HealthInsuranceMgm.Admin
{
    public partial class EmpViewPolicy : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            load();
            Panel1.Visible = true;
            Panel2.Visible = false;
        }
        public void load()
        {
            BLLPolicies bll = new BLLPolicies();
            grvPolicy.DataSource = bll.ListPolicy();
            grvPolicy.DataBind();
        }
        public void LoadData(int CompanyId)
        {

            BLLCompany obj = new BLLCompany();
            DTOCompanyDetail objDt = new DTOCompanyDetail();

            objDt.CompanyId = CompanyId;
            DataTable dt = obj.GetCompanyById(objDt);

            lblid.Text = dt.Rows[0]["CompanyId"].ToString();
            lblname.Text = dt.Rows[0]["CompanyName"].ToString();
            lbladdress.Text = dt.Rows[0]["Address"].ToString();
            lblphone.Text = dt.Rows[0]["Phone"].ToString();
            lblurl.Text = dt.Rows[0]["CompanyUrl"].ToString();
           

        }
        protected void grvPolicy_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
        {
            Panel1.Visible = false;
            Panel2.Visible = true;
            int PolicyId = Int32.Parse(grvPolicy.DataKeys[e.NewSelectedIndex].Value.ToString());
            LoadData(PolicyId);
        }
    }
}